package com.typhoon.controller

import com.typhoon.entity.User
import com.typhoon.service.HelloService
import com.typhoon.service.UserService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController

/**
 *
 * @author shuya | dongfeng.zdf@alibaba-inc.com
 * @description
 * @date 2018/10/24 下午3:04
 * @since V2.0.0
 * @description
 * @modified by
 */
@RestController
class HelloController {

    @Autowired
    private lateinit var helloService: HelloService

    @Autowired
    private lateinit var userService: UserService


    @GetMapping("/hello")
    fun helloKotlin(): String {
        return "hello,world!"
    }

    @GetMapping("/hello-service")
    fun helloKotlinService(): String {
        return helloService.hello()
    }

    @GetMapping("/user/{id}")
    fun queryUser(@PathVariable("id") id:Long) : User? {
        return this.userService.queryById(id)
    }

}